package com.yanmaohu.yulia.bean;

/**
 * @author Bright Lee
 */
public final class SchemaName {

    private final CatalogName catalogName;
    private final Identifier unqualifiedSchemaName;

    public SchemaName(CatalogName catalogName, Identifier unqualifiedSchemaName) {
        this.catalogName = catalogName;
        this.unqualifiedSchemaName = unqualifiedSchemaName;
    }

    public int getBeginIndex() {
        if (catalogName != null) {
            return catalogName.getBeginIndex();
        }
        return unqualifiedSchemaName.getBeginIndex();
    }

    public int getEndIndex() {
        return unqualifiedSchemaName.getEndIndex();
    }

    public CatalogName getCatalogName() {
        return catalogName;
    }

    public Identifier getUnqualifiedSchemaName() {
        return unqualifiedSchemaName;
    }

}
